package org.gosdt.ew.model;

import java.util.ArrayList;

import org.gosdt.ew.db.LanguagesDBAccess;

/**
 * Class describe Language entity allow to access to DB Created language never
 * update
 * 
 * @author anton
 */
public class Languages {
	private LanguagesDBAccess persistObject;
	
	private String name = ""; // language name
	private boolean isExist = false; // variable for checking is need to insert to db

	public Languages() {
		persistObject = LanguagesDBAccess.create(this);
	}

	public String getName() {
		return name;
	}

	public void setName(String newName) {
		name = newName;
	}

	public boolean isExists() {
		return isExist;
	}

	public void setExist(boolean isExist) {
		this.isExist = isExist;
	}

	public ArrayList<Languages> getAllLanguages() {
		return persistObject.getListInDB();
	}

	public static Languages GetOneRowByName(String languageName) {
		return LanguagesDBAccess.GetOneRowByName(languageName);
	}

	public int insertCurRecord() {
		return persistObject.insertCurRecord();
	}

}
